package com.alks.function.controller;


import com.alks.common.aop.ApiRestController;
import com.alks.entity.data.entity.SdCompany;
import com.alks.entity.data.response.ResponseInfo;
import com.alks.function.service.SdCompanyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@ApiRestController("/company")
@Api(tags = "公司资料")
@Slf4j
public class SdCompanyController {

    @Autowired
    private SdCompanyService companyService;

    @PostMapping("/AddCompanyInfo")
    @ApiOperation(value = "添加公司信息")
    public ResponseInfo AddCompanyInfo(@RequestBody SdCompany sdCompany){
        return companyService.SaveCompanyInfo(sdCompany);
    }

    @PostMapping("/FindCompanyInfo")
    @ApiOperation(value = "根据id查询")
    public ResponseInfo FindCompanyInfo(@RequestParam(value = "companyId") String companyId){
        return companyService.FindCompanyInfoById(companyId);
    }

    @ApiOperation(value = "查询所有")
    @GetMapping("FindCompanyInfoAll")
    public ResponseInfo FindCompanyInfoAll(){
        return companyService.FindAll();
    }

    @PutMapping("/UpdateCompanyInfo")
    @ApiOperation(value = "修改信息")
    public ResponseInfo UpdateCompanyInfo(@RequestBody SdCompany sdCompany){
        return companyService.UpdateWithCompanyInfo(sdCompany);
    }

}
